import { APIRegister } from './fetch.js';
layui.use(['layer'], function () {
    var layer = layui.layer;
    $('#register-btn').click(function () {
        var username = $('#username').val();
        var password = $('#password').val();
        var password2 = $('#inp_c').val();
        console.log(username,password)
        if(password2 == password){
            APIRegister({
                username,
                password
            }).then(({ code, msg }) => {
                if (code) {
                    layer.msg(msg);
                    location.href = './login.html'
                } else {
                    layer.msg(msg);
                }
            })
        }else{
            alert('密码不一致')
        }
        
    })




})